@aspan-corporation/ac-shared 1.2.32 → 1.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -29,6 +29,7 @@ export type AcServices = {
29
29
  stsService?: STSService;
30
30
  sourceS3Service?: S3Service;
31
31
  destinationS3Service?: S3Service;
32
+ localS3Service?: S3Service;
32
33
  };
33
34
  export type AcContext = Context & {
34
35
  logger: Logger;
@@ -19,6 +19,13 @@ export declare class S3Service {
19
19
  listObjectsV2(listObjectsV2CommandInput: ListObjectsV2CommandInput): Promise<import("@aws-sdk/client-s3").ListObjectsV2CommandOutput>;
20
20
  getObject(getObjectCommandInput: GetObjectCommandInput): Promise<Buffer>;
21
21
  getSignedUrl(getObjectCommandInput: GetObjectCommandInput): Promise<string>;
22
+ /**
23
+ * Presigned PUT URL — lets a browser upload a single object directly to S3
24
+ * without the bytes passing through the API/Lambda. Sign without locking a
25
+ * ContentType so the client may send any Content-Type header; the object's
26
+ * extension (not its stored MIME type) drives downstream processing.
27
+ */
28
+ getSignedUploadUrl(putObjectCommandInput: PutObjectCommandInput, expiresIn?: number): Promise<string>;
22
29
  putObject(putObjectCommandInput: PutObjectCommandInput): Promise<PutObjectCommandOutput>;
23
30
  headObject(headObjectCommandInput: HeadObjectCommandInput): Promise<import("@aws-sdk/client-s3").HeadObjectCommandOutput>;
24
31
  checkIfObjectExists(headObjectCommandInput: HeadObjectCommandInput): Promise<boolean>;
@@ -60,6 +60,17 @@ export class S3Service {
60
60
  const signedUrl = await getSignedUrl(this.client, new GetObjectCommand(getObjectCommandInput), { expiresIn: 3600 });
61
61
  return signedUrl;
62
62
  }
63
+ /**
64
+ * Presigned PUT URL — lets a browser upload a single object directly to S3
65
+ * without the bytes passing through the API/Lambda. Sign without locking a
66
+ * ContentType so the client may send any Content-Type header; the object's
67
+ * extension (not its stored MIME type) drives downstream processing.
68
+ */
69
+ async getSignedUploadUrl(putObjectCommandInput, expiresIn = 3600) {
70
+ this.logger.debug("getSignedUploadUrl", { putObjectCommandInput });
71
+ const signedUrl = await getSignedUrl(this.client, new PutObjectCommand(putObjectCommandInput), { expiresIn });
72
+ return signedUrl;
73
+ }
63
74
  async putObject(putObjectCommandInput) {
64
75
  this.logger.debug("putObject", { putObjectCommandInput });
65
76
  return await this.client.send(new PutObjectCommand(putObjectCommandInput));
@@ -99,6 +99,10 @@ export const tokenizeText = (markdown) => {
99
99
  // fenced + inline code
100
100
  .replace(/```[\s\S]*?```/g, " ")
101
101
  .replace(/`[^`]*`/g, " ")
102
+ // angle-bracket image targets `![alt](<…>)` first — the destination may
103
+ // contain ")" (e.g. a filename like "image (2).jpg"), which the generic
104
+ // `\([^)]*\)` form below would mis-match.
105
+ .replace(/!\[([^\]]*)\]\(<[^>]*>\)/g, " $1 ")
102
106
  // image / link targets: keep the visible text, drop the URL/key
103
107
  .replace(/!\[([^\]]*)\]\([^)]*\)/g, " $1 ")
104
108
  .replace(/\[([^\]]*)\]\([^)]*\)/g, " $1 ")
@@ -124,6 +128,10 @@ export const diaryPreview = (markdown) => {
124
128
  const text = markdown
125
129
  .replace(/```[\s\S]*?```/g, " ")
126
130
  .replace(/`[^`]*`/g, " ")
131
+ // angle-bracket image targets first — the destination may contain ")"
132
+ // (e.g. "image (2).jpg"), which the generic form below would mis-match,
133
+ // leaking ".jpg )" into the preview.
134
+ .replace(/!\[[^\]]*\]\(<[^>]*>\)/g, " ")
127
135
  .replace(/!\[([^\]]*)\]\([^)]*\)/g, " ")
128
136
  .replace(/\[([^\]]*)\]\([^)]*\)/g, " $1 ")
129
137
  .replace(/[#>*_~]+/g, " ")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aspan-corporation/ac-shared",
3
- "version": "1.2.32",
3
+ "version": "1.2.34",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "exports": {